package com.lingx.model.impl.interpreter;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.stereotype.Component;

import com.lingx.model.impl.AbstractInterpreter;
@Component
public class TimeStampInterpreter2  extends AbstractInterpreter{

	private static final long serialVersionUID = 5538176628740005029L;

	public TimeStampInterpreter2() {
		super("TimeStampInterpreter2","毫秒级时间戳转yyyy-MM-dd HH:mm:ss");
	}
	@Override
	public Object input(Object value) throws Exception {
		String datetime=value.toString();
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date=sdf.parse(datetime);
		return date.getTime();
	}

	@Override
	public Object output(Object value) throws Exception {

		long ts=Long.parseLong(value.toString());
		Date date=new Date(ts);
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return sdf.format(date);
	}
	
	

}
